using System;

namespace SharpMud.MudLib.SAMPLE.Net.SessionStates
{
	public class SendWelcomeScreen : SessionStateBase
	{
		private bool			_MessageSent;

		public override string StateID
		{
			get
			{
				return GetStateID();
			}
		}

		protected string GetStateID()
		{
			return "SendWelcomeScreen";
		}

		public override void Pulse()
		{
			if(MessageSent==false)
			{
				this.Session.Write(GetWelcomeScreen());
				_MessageSent = true;
				base.SetInactive();
			}
		}

		public bool MessageSent
		{
			get
			{
				return _MessageSent;
			}
		}

		public SendWelcomeScreen()
		{
		}

		public override void Dispose()
		{
			
		}

//		private const string DefWelcomeString
//= @"[#black][white]Welcome... [yellow]to the [blue]SharpMud[white] implementation of [cyan]SAMPLE[white]!^!"
//+ @"[yellow]^!"
//+ @"SharpMud Framework          v0.6 (   BETA  )^!"
//+ @"SharpMud.MudLib.SAMPLE (1.0) v0.6 (  ALPHA  )^!"
//+ @"Copyright (C) 2004-2005 Bruce Markham^!"
//+ @"^!"
//+ @"[yellow]    _  _                                                       ^!"
//+ @"[yellow]  _| || |_ [blue]  _   _   _                                         ^!"
//+ @"[yellow] |_  __  _|[blue] / \ / \ / \                                        ^!"
//+ @"[yellow]  _| || |_ [blue]( [white]M[blue] | [white]U[blue] | [white]D[blue] )                                       ^!"
//+ @"[yellow] |_  __  _|[blue] \_/ \_/ \_/                                        ^!"
//+ @"[yellow]   |_||_|  [cyan]                                            ^!"
//+ @"               _/_/_/  _/    _/  _/_/_/    _/_/_/      _/_/_/  ^!"
//+ @"            _/        _/    _/  _/    _/  _/    _/  _/         ^!"
//+ @"           _/  _/_/  _/    _/  _/_/_/    _/_/_/      _/_/      ^!"
//+ @"          _/    _/  _/    _/  _/    _/  _/              _/     ^!"
//+ @"           _/_/_/    _/_/    _/    _/  _/        _/_/_/        ^!"
//+ @"          Generic    Universal  Role - Playing   System        ^!"
//+ @"                                                               ^!"
//+ @"[green]This a [white]BETA[green] system...^!"
//+ @"...[red]nothing[green] is gaurunteed to work - some things even lack purpose!^!"
//+ @"[white]^!";
//
//		private const string PlainWelcomeString
//			= @"Welcome... to the SharpMud implementation of SAMPLE!" + "\n"
//			+ @"" + "\n"
//			+ @"SharpMud Framework          v0.6 (   BETA  )"+ "\n"
//			+ @"SharpMud.MudLib.SAMPLE (1.0) v0.6 (  ALPHA  )"+ "\n"
//			+ @"Copyright (C) 2004-2005 Bruce Markham"  + "\n"
//			+ @""+ "\n"
//			+ @"    _  _                                                       "+ "\n"
//			+ @"  _| || |_   _   _   _                                         "+ "\n"
//			+ @" |_  __  _| / \ / \ / \                                        "+ "\n"
//			+ @"  _| || |_ ( M | U | D )                                       "+ "\n"
//			+ @" |_  __  _| \_/ \_/ \_/                                        "+ "\n"
//			+ @"   |_||_|                                                      "+ "\n"
//			+ @"               _/_/_/  _/    _/  _/_/_/    _/_/_/      _/_/_/  "+ "\n"
//			+ @"            _/        _/    _/  _/    _/  _/    _/  _/         "+ "\n"
//			+ @"           _/  _/_/  _/    _/  _/_/_/    _/_/_/      _/_/      "+ "\n"
//			+ @"          _/    _/  _/    _/  _/    _/  _/              _/     "+ "\n"
//			+ @"           _/_/_/    _/_/    _/    _/  _/        _/_/_/        "+ "\n"
//			+ @"          Generic    Universal  Role - Playing   System        "+ "\n"
//			+ @"                                                               "+ "\n"
//			+ @"This a BETA system..."+ "\n"
//			+ @"...*nothing* is gaurunteed to work - some things even lack purpose!"+ "\n"
//			+ @""+ "\n";

		private string GetWelcomeScreen()
		{
			System.Version	frameworkVersion = typeof(SharpMud.Server.App.Application).Assembly.GetName().Version;
			System.Version mudlibVersion = typeof(SharpMud.MudLib.SAMPLE.MudLibRoot).Assembly.GetName().Version;
			string			remoteHost	= this.Session.RemoteHostName;


			string s 
     = @"[#black][white]Welcome... [yellow]to the flagship [blue]SharpMud [white]server!^!"
			+ @"[yellow]^!"
			+         @"SharpMud Framework          v" + frameworkVersion.ToString().PadRight(10) + "^!"
			+         @"SharpMud.MudLib.SAMPLE (1.0) v" + mudlibVersion.ToString().PadRight(10)    + "^!"
			+         @"Copyright (C) 2004-2005 Bruce Markham^!"
			+         @"^!"
			+ @"[yellow]    _  _                                                       ^!"
			+ @"[yellow]  _| || |_ [blue]  _   _   _                                         ^!"
			+ @"[yellow] |_  __  _|[blue] / \ / \ / \                                        ^!"
			+ @"[yellow]  _| || |_ [blue]( [white]M[blue] | [white]U[blue] | [white]D[blue] )^!"
			+ @"[yellow] |_  __  _|[blue] \_/ \_/ \_/                                        ^!"
			+ @"[yellow]   |_||_|  [cyan]                                                    ^!"
			+         @"                  SAMPLE MudLib                                ^!"
			+         @"                                                               ^!"
			+         @"                                                               ^!"
			+         @"                                                               ^!"
			+ @"[green]You are connected from: [white]" + remoteHost + "[green]^!"
			+ @"[green]Current Server Time:    [white]" + System.DateTime.Now.ToString() + "[green]^!"
			+ @"[green]                        [white]" + SharpMud.MudLib.Core.Time.MudDateTime.Now.ToString() + "[green]^!"
			+ @"[green]People Playing:         [white]" + this.MudServer.PlayerSystem.PlayingPlayers.Length.ToString() + "[green]^!"
			+         @"                                                               ^!"
			+         @"                                                               ^!";

			return s;
		}	
	}
}
